//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

namespace Microsoft.Research.ProvenanceCommon.Model
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using SR = Microsoft.Research.DataLayer;

    public class PerformanceModel
    {
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="performanceInfo">PerformanceStat</param>
        public PerformanceModel(SR.PerformanceStat performanceInfo)
        {
            this.Average = performanceInfo.Average;
            this.Maximum = performanceInfo.Maximum;
            this.Minimum = performanceInfo.Minimum;
            this.PerformanceCounter = performanceInfo.Name;
        }

        /// <summary>
        /// Empty Constructor
        /// </summary>
        public PerformanceModel()
        {
        }

        /// <summary>
        /// Gets or sets Average
        /// </summary>
        public string Average { get; set; }

        /// <summary>
        /// Gets or sets Minimum
        /// </summary>
        public string Minimum { get; set; }

        /// <summary>
        /// Gets or sets Maximum
        /// </summary>
        public string Maximum { get; set; }

        /// <summary>
        /// Gets or sets PerformanceCounter
        /// </summary>
        public string PerformanceCounter { get; set; }

        /// <summary>
        /// Overridden tostring method. For automation Ids.
        /// </summary>
        /// <returns>The string representation of the object.</returns>
        public override string ToString()
        {
            if (!string.IsNullOrEmpty(this.PerformanceCounter))
            {
                return this.PerformanceCounter;
            }
            return base.ToString();
        }
    }
}
